<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>ClipWait</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>ClipWait</h1>

<p>Waits until the <a href="../misc/Clipboard.htm">clipboard</a> contains data.</p>

<pre class="Syntax">ClipWait [, SecondsToWait, 1]</pre>
<h3>Parameters</h3>
<dl>

  <dt>SecondsToWait</dt>
  <dd><p>If omitted, the command will wait indefinitely. Otherwise, it will wait no longer than this many seconds (can contain a decimal point or be an <a href="../Variables.htm#Expressions">expression</a>). Specifying 0 is the same as specifying 0.5.</p></dd>

  <dt>1</dt>
  <dd><p>If this parameter is omitted, the command is more selective, waiting specifically for text or files to appear (&quot;text&quot; includes anything that would produce text when you paste into Notepad). If this parameter is 1 (can be an <a href="../Variables.htm#Expressions">expression</a>), the command waits for data of any kind to appear on the clipboard.</p></dd>

</dl>

<h3>ErrorLevel</h3>
<p>If the wait period expires, <a href="../misc/ErrorLevel.htm">ErrorLevel</a> will be set to 1. Otherwise (i.e. the clipboard contains data), ErrorLevel is set to 0.</p>
<h3>Remarks</h3>
<p>It's better to use this command than a loop of your own that checks to see if this clipboard is blank. This is because the clipboard is never opened by this command, and thus it performs better and avoids any chance of interfering with another application that may be using the clipboard.</p>
<p>This command considers anything convertible to text (e.g. HTML) to be text. It also considers files, such as those copied in an Explorer window via Control-C, to be text. Such files are automatically converted to their filenames (with full path) whenever the clipboard variable (%clipboard%) is referred to in the script. See <a href="../misc/Clipboard.htm">Clipboard</a> for details.</p>
<p>When 1 is present as the last parameter, the command will be satisified when any data appears on the clipboard. This can be used in conjunction with <a href="../misc/Clipboard.htm#ClipboardAll">ClipboardAll</a> to save non-textual items such as pictures.</p>
<p>While the command is in a waiting state, new <a href="../misc/Threads.htm">threads</a> can be launched via <a href="../Hotkeys.htm">hotkey</a>, <a href="Menu.htm">custom menu item</a>, or <a href="SetTimer.htm">timer</a>.</p>
<h3>Related</h3>
<p><a href="../misc/Clipboard.htm">Clipboard</a>, <a href="WinWait.htm">WinWait</a>, <a href="KeyWait.htm">KeyWait</a></p>
<h3>Example</h3>
<pre class="NoIndent">clipboard = <em>; Empty the clipboard</em>
Send, ^c
ClipWait, 2
if ErrorLevel
{
    MsgBox, The attempt to copy text onto the clipboard failed.
    return
}
MsgBox, clipboard = %clipboard%
return</pre>

</body>
</html>
